<template tag="以下文档内容为hycli自动生成">
  <div style="height: 100%">
    <div style="margin:0.8rem;"><h5 style="display:inline">角色权限</h5><span style="margin-left: 0.5rem; color:#999"> </span>
    </div>
    <hr style="margin-top:0;color:#999"/>
<div class="query">
    
    <el-form :model="form_aaatu" inline >
        <!-- 日期控件个数： 0 -->
        <!--系统 下拉控件 -->
        <el-form-item>
            <el-select  v-model="form_aaatu.sys_id" style="width: 100px" filterable clearable placeholder="系统">
                <el-option v-for="item in sys_idList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
        </el-form-item>
        <!--角色 下拉控件 -->
        <el-form-item>
            <el-select  v-model="form_aaatu.role_id" style="width: 100px" filterable clearable placeholder="角色">
                <el-option v-for="item in role_idList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
        </el-form-item>
        <!-- 控件个数：[] -->

        <span class="ddl">
        </span>
        <el-form-item>
            <el-space wrap>
                <el-button type="primary" icon="Search" @click="onQuery(true)">查询</el-button>
                <el-button :type="$js.page.tagColor(0)"  icon="Plus"  @click="show_cmpnt_aaaui">添加</el-button>
            </el-space>
        </el-form-item>
        

        <!-- xtabs -->
        

    </el-form>
</div>
<div>
   <aaaui ref="cmpnt_aaaui" @onsaved="onQuery"></aaaui>
   <aaauh ref="cmpnt_aaauh" @onsaved="onQuery"></aaauh>
   <aaaug ref="cmpnt_aaaug" @onsaved="onQuery"></aaaug>
</div>
<div class="list">
    <el-table :data="dataList_aaatu"
    
    v-loading="conf.loading" stripe  style="width: 100%;height:calc(100vh - 160px)"
         empty-text="无数据">le
<el-table-column width="24px" type="expand">
    <template #default="view">
        <el-row :gutter="24">
            <el-col :span="5" class="text-right" style="min-height:26px">编号:</el-col>
            <el-col :span="7" v-text="view.row.le_id" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">系统:</el-col>
            <el-col :span="7" v-text="view.row.sys_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">角色:</el-col>
            <el-col :span="7" v-text="view.row.role_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">菜单:</el-col>
            <el-col :span="7" v-text="view.row.menu_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">创建时间:</el-col>
            <el-col :span="7" v-text="view.row.le_create_time" style="min-height:26px" ></el-col>
        </el-row>
    </template>
</el-table-column>
        
        	<!--id text -->
        <el-table-column  show-overflow-tooltip    align="center" label="编号" >
            <template #default="scope">
                  <span>{{ scope.row.id||'-' }}</span>
              </template>
        </el-table-column>
        	<!--sys_id select -->
        <el-table-column     prop="sys_id" align="center" label="系统">
            <template #default="scope">
                <span 
                    v-text="scope.row.sys_id_label"></span>
            </template>
        </el-table-column>
        	<!--role_id select -->
        <el-table-column     prop="role_id" align="center" label="角色">
            <template #default="scope">
                <span 
                    v-text="scope.row.role_id_label"></span>
            </template>
        </el-table-column>
        	<!--menu_id select -->
        <el-table-column     prop="menu_id" align="center" label="菜单">
            <template #default="scope">
                <span 
                    v-text="scope.row.menu_id_label"></span>
            </template>
        </el-table-column>
        	<!--create_time date -->
        <el-table-column  show-overflow-tooltip    align="center" label="创建时间" >
            <template #default="scope">
                  <span>{{ scope.row.create_time||'-' }}</span>
              </template>
        </el-table-column>

<el-table-column fixed="right" align="center" label="操作" width="112">
    <template #default="scope">
        <div class="opts">
            <el-button   type="text" @click="show_cmpnt_aaauh(scope.row)" >详情 </el-button>
            <el-button   type="text" @click="show_cmpnt_aaaug(scope.row)" >编辑 </el-button>
        </div>
    </template>
</el-table-column>
    </el-table>
    <el-pagination :currentPage="form_aaatu.pi" :page-size="form_aaatu.ps"
        style="position: absolute; right: 30px;bottom:6px;" :page-sizes="[10,15,20,30, 50, 100]" :background="false" small
        layout="total,sizes,prev, pager, next, jumper" :total="total_aaatu" @size-change="handleSizeChange"
        @current-change="handleCurrentChange" />
</div>
  </div>
</template>
<script>
// 添加
import aaaui from "@/views/sso/role/role_menu.add"
// 详情
import aaauh from "@/views/sso/role/role_menu.view"
// 编辑
import aaaug from "@/views/sso/role/role_menu.edit"



export default {
components: {
    aaaui,
    aaauh,
    aaaug,
},
data() {
  return {
    shortcuts: this.$js.page.latestDays(),
    cmpnt_funcs:{},
    conf: {
      loading: false,
      progressColor: this.$theia.env.conf.progress || []
    },
    ganttIdx: -1,
        form_aaatu: {
            pi: 1,
            ps: 15,
            disabled:false,
            single_date_range_name:"",
            single_date_range_value:[],
            single_text_name:"",
            single_text_value:"",
            sys_id:"",
            role_id:"",
            },
            sys_idList:[],
            role_idList:[],
            menu_idList:[],
            dataList_aaatu:[],
            multiQueryDateRange:[],
            multiQueryText:[],
            total_aaatu:0,
            note_dataList:[],
};
  },
mounted() {
  this.loadEnums_aaatu()
  this.form_aaatu.single_date_range_name = (this.multiQueryDateRange[0]||{}).value
  this.form_aaatu.single_text_name = (this.multiQueryText[0]||{}).value
  this.cmpnt_funcs["aaaui"] = this.show_cmpnt_aaaui
  this.cmpnt_funcs["aaauh"] = this.show_cmpnt_aaauh
  this.cmpnt_funcs["aaaug"] = this.show_cmpnt_aaaug

  this.form_aaatu = Object.assign(this.form_aaatu,this.$route.params)
  this.queryData_aaatu ()
    },
methods: {
  ganttChange(id) {
      this.ganttIdx = id
    },

queryData_aaatu(mform = {},nform={}){
    //构建查询参数
    let queryForm = Object.assign({},this.form_aaatu)
    queryForm = Object.assign(queryForm,nform||{})
    
    //处理多个日期选择
    queryForm[this.form_aaatu.single_date_range_name] = this.form_aaatu.single_date_range_value
    queryForm[this.form_aaatu.single_text_name] = this.form_aaatu.single_text_value
   
    //处理日期范围选择

    queryForm[this.form_aaatu.single_date_range_name] = null
    queryForm.single_date_range_value = null
    queryForm.single_date_range_name = null

    queryForm.single_text_value = null
    queryForm.single_text_name = null
 
    //处理关联表role_menu role_menu 
   
    //发送查询请求
    let that = this
    that.conf.loading = true
    //构建统计查询
  //数据查询
  this.$theia.http.get("/sso/role/menu/query",queryForm).then(res=>{
      if((res.items||[]).length < (queryForm.ps||10)){
        that.form_aaatu.disabled = true
      }
      that.conf.loading = false
      that.dataList_aaatu = res.items||[]
      that.total_aaatu = res.count
      that.resetItemData_aaatu(that,that.dataList_aaatu)
    });
  },

  resetItemData_aaatu(that,lst){
    lst.forEach(item => {
      item.__raw = Object.assign({}, item)
    item.sys_id_label = that.$theia.enum.getName("system_info",item.sys_id)
    item.role_id_label = that.$theia.enum.getName("role_info",item.role_id)
    item.menu_id_label = that.$theia.enum.getName("system_menu",item.menu_id)
    item.id_progress = item.id
    item.sys_id_progress = item.sys_id
    item.role_id_progress = item.role_id
    item.menu_id_progress = item.menu_id
    item.create_time_progress = item.create_time
    item.le_id = item.id
    item.le_sys_id = item.sys_id
    item.le_role_id = item.role_id
    item.le_menu_id = item.menu_id
    item.le_create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    item.create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    if(item.children){
      that.resetItemData_aaatu(that,item.children)
    }
  });
  },
    loadEnums_aaatu(){
        //系统
        this.sys_idList = this.$theia.enum.get("system_info","","" ,false,"")
        //角色
        this.role_idList = this.$theia.enum.get("role_info","","" ,false,"")
        //系统
        this.sys_idList = this.$theia.enum.get("system_info","","" ,false,"")
        //角色
        this.role_idList = this.$theia.enum.get("role_info","","" ,false,"")
        //菜单
        this.menu_idList = this.$theia.enum.get("system_menu","","" ,false,"")
    },

  handleSizeChange(ps){
    this.form_aaatu.ps = ps
    this.onQuery(true)
  },
  handleCurrentChange(pi){
    this.form_aaatu.pi = pi
    this.onQuery()
  },
  onQuery(refresh){
    if(refresh){
      this.form_aaatu.pi = 1
    }
    this.queryData_aaatu ()
  },
show_cmpnt(cmd,row){
  if(this.cmpnt_funcs[cmd]){
    this.cmpnt_funcs[cmd](row)
  }
},
  //详情
  show_cmpnt_aaauh(fm = {}){
    let query = {} 
    query.id = fm.id|| fm.le_id 
    query.sys_id = fm.sys_id|| fm.le_sys_id 
    query.role_id = fm.role_id|| fm.le_role_id 
    query.menu_id = fm.menu_id|| fm.le_menu_id 
    query.create_time = fm.create_time|| fm.le_create_time 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="详情"
    this.$refs.cmpnt_aaauh.show(query)
  },
  //添加
  show_cmpnt_aaaui(fm = {}){
    let query = {} 
    query.sys_id = fm.sys_id|| fm.le_sys_id 
    query.role_id = fm.role_id|| fm.le_role_id 
    query.menu_id = fm.menu_id|| fm.le_menu_id 
    query.id = fm.id

      //2023.4.18添加---
    query.status = "0"

    query.$title="添加"
    this.$refs.cmpnt_aaaui.show(query)
  },
  //编辑
  show_cmpnt_aaaug(fm = {}){
    let query = {} 
    query.sys_id = fm.sys_id|| fm.le_sys_id 
    query.menu_id = fm.menu_id|| fm.le_menu_id 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="编辑"
    this.$refs.cmpnt_aaaug.show(query)
  },
},
};
</script>
<style>
.el-dialog{
  border-radius:5px !important
}
</style>
<style scoped>
.el-form-item {
  margin-right: 10px !important;
}

.opts .el-button--small {
  margin-left: 0px;
  padding-left: 0px;
  margin-right: 4px;
}

/deep/.el-table td.el-table__cell div {
  vertical-align: middle;
}
/deep/.el-button+.el-dropdown{
  margin-left:0px;
}
/deep/.el-button+.el-button{
  margin-left:0px;
}
.el-button{
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.blist {
  margin-bottom: 8px;
  width: 100%;
}

.blist .el-radio-group {
  margin-right: 8px;
}

.ddl {
  margin-bottom: 8px;
  width: 100%;

}

.ddl .el-dropdown {
  margin-right: 8px;
}

.listbar {
  margin-bottom: 8px;
  text-align: center;
}
 .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
  font-size: 0.65rem;
}
/deep/.el-button--small{
  padding: 5px 4px;
}

.prepend /deep/.el-input__wrapper{
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.prepend+/deep/.el-date-editor{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
  border-left:0;
}

</style>